//
//  LSZNoticeParentViewController.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/12/10.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZNoticeParentViewController.h"

@interface LSZNoticeParentViewController ()<LCDisplayViewControllerDelegate>
@property(nonatomic,strong) UIView * viewFenGe;

@end

@implementation LSZNoticeParentViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden=YES;
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden=NO;
}
-(void)goToLogin
{
    [LSZPublicClassDataToll goToLogin];
}
-(void)addNotificationCenter
{
    NSString * strDelete = [NSString stringWithFormat:@"%@Login",@"LSZLiteratureViewController"];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(goToLogin) name:strDelete object:nil];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self addNotificationCenter];
    self.delegate = self;
    [self setupAllViewController];
    [self setupAllVCData];
    self.view.backgroundColor = [UIColor whiteColor];
    UIView * viewFenGe = [[UIView alloc]initWithFrame:CGRectMake(0, 43+NAVIGATION_BAR_HEIGHT, ScreenWidth, 1)];
    _viewFenGe = viewFenGe;
    viewFenGe.backgroundColor = dividerColor;
    [self.view addSubview:viewFenGe];
    [viewFenGe sendSubviewToBack:self.view];
    /**增加侧滑返回,无其他作用*/
    //    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, ScreenHeight)];
    //    [self.view addSubview:view];
    //    [self.view bringSubviewToFront:view];
    UIBarButtonItem *backItem=[[UIBarButtonItem alloc]init];
    backItem.title=@"扶贫政策";
    backItem.tintColor=[UIColor whiteColor];
    self.navigationItem.backBarButtonItem = backItem;
}
-(void)callModalList
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)setupAllViewController {
    //下划线
    [self setUpUnderLineEffect:^(BOOL *isUnderLineDelayScroll, CGFloat *underLineH, UIColor *__autoreleasing *underLineColor, BOOL *isUnderLineEqualTitleWidth) {
        // 标题填充模式
        *underLineColor = themeColor;
        *underLineH = 2;
    }];
    // 标题渐变
    // *推荐方式(设置标题渐变)
    [self setUpTitleGradient:^(LCTitleColorGradientStyle *titleColorGradientStyle, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor) {
        *norColor = RGBColor(51, 51, 51);
        // 设置标题选中颜色
        *selColor = themeColor;
    }];
    // 设置标题字体
    // 推荐方式
    [self setUpTitleEffect:^(UIColor *__autoreleasing *titleScrollViewColor, UIColor *__autoreleasing *norColor, UIColor *__autoreleasing *selColor, UIFont *__autoreleasing *titleFont, CGFloat *titleHeight, CGFloat *titleWidth) {
        // 设置标题字体
        if (ScreenWidth == 414) {
            *titleFont = FONT_(15.5);
        }else
            if (ScreenWidth == 375) {
                *titleFont = FONT_(15);
            }else{
                *titleFont = FONT_(14.5);
            }
    }];
}
- (void)setupAllVCData {
    // 移除之前所有子控制器
    [self.childViewControllers makeObjectsPerformSelector:@selector(removeFromParentViewController)];
    NSArray * array = @[@"任务通知",@"督察报告"];
     NSString * string = @"/catalog/task/list";
    [LSZRequestDicData obtainClassificationData:string :^(BOOL isOk, NSString * string, LSZLiteratureClassificationManager * manager) {
        if (isOk == YES) {
            for (NSInteger i = 0; i < manager.mutNameArray.count; i++) {
                LSZTaskInformViewController * VC = [[LSZTaskInformViewController alloc]init];
                LSZLiteratureClassificationMg * mg = nil;
                mg = manager.mutMgArray[i];
                VC.type = mg.id_id;
                VC.title = array[i];
                [self addChildViewController:VC];
            }
            // 注意：必须先确定子控制器
            [self refreshDisplay];
        }else{
            if ([string isEqualToString:@"重复登录"]) {
                [LSZPublicClassDataToll RepeatLoginInterfaceJump:self.view fromVC:@"LSZParentPartyKnowledgeVC"];
            }else{
                [LSZPublicClassDataToll initWithAlertKuangView:self.view string:string];
            }
        }
    }];
    
    
    
    
}
-(void)tabBarContentViewDidSelectItemAtIndex:(NSInteger)index{
    [[NSUserDefaults standardUserDefaults] setInteger:index forKey:@"didSelectAudioChannelAtCid"];
}
///标签头部底部分割线
- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    [_viewFenGe sendSubviewToBack:self.view];
}
@end
